﻿#ifndef CPresetAreaSetDialog_H
#define CPresetAreaSetDialog_H
/********************************************************************************
** @ Date:2024/06/17
** @ Author: AoZhiQiang
** @ Description:巡检点区域配置
** @ Version:1.0.0
** @ ClassName:
** @ Fun:
********************************************************************************/
#include <QMouseEvent>
#include <QDialog>
#include "ui_CPresetAreaSetDialog.h"
#include "CCamerSdkOper.h"

class CDevBase;
class CPresetAreaSetDialog : public QDialog
{
	Q_OBJECT

public:
	CPresetAreaSetDialog(QWidget *parent = nullptr);
	~CPresetAreaSetDialog();

	void setCamearData(QString sSceneGuid, WORD wPresetNo, CDevBase* pDev, CDevDataCam *pDevDataCam);  //设置相机数据
	void generateTemperatureMessage(LONG lRealHandle, HDC hdc, DWORD dwUser);    //在视频上绘制温度信息
	void generateBoxArea(LONG lRealHandle, HDC hdc, DWORD dwUser);  //在视频上生成矩形方框

protected:
	void mouseMoveEvent(QMouseEvent * event) override;
	void mousePressEvent(QMouseEvent *event) override;
	void mouseReleaseEvent(QMouseEvent* event) override;
	void closeEvent(QCloseEvent *event) override;

private:
	void initUI();
	void initData();
	void setStyleSheetFile();   //设置样式文件

	bool drawRectBox();  //绘制矩形方框
	void generateBox(QPointF pointA, QPointF pointC);   //生成通过坐标（ A-左上角  C-右下角）生成矩形
	void generateRectPointInfo();     //生成矩形坐标信息

	bool playVideo();						//播放视频
	bool stopVideo();						//停止播放视频

private slots:
	void slotChangeDistanceUnity(int nType);   //切换距离的单位
	void slotClearSelect();                    //清除当前框选

private:
	Ui::CPresetAreaSetDialogClass ui;
	QString m_sGuid;                      //场景Guid
	CDevBase* m_pDev;                             //设备操作对象
	CDevDataCam *m_pDevDataCam;                //云台设备对象
	int m_nRectLength;   //视频框长度
	int m_nRectWidth;    //视频框宽度
	HWND m_hwnd;      //视频显示label的标志
	LONG m_lHandle;      //视频显示句柄
	SPersetAreaRect m_sDetectRect;  //矩形框坐标信息
	WORD m_wPresetNo;     //预设点号
	SPersetAreaParam m_sPersetData;   //预设点相关参数
	QButtonGroup* m_pButtonGroup;
	QMap<QString, QPointF> m_mapGraphPoints;
	int m_nPointNum;       //框选点数量
	bool m_bIsDraw;       //是否开启画图
};

#endif // 